package fr.umlv.android.caveAVin.activities;


import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.Log;
import android.widget.TabHost;

public class MainMenu extends TabActivity {
	
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.main_menu);

	    Resources res = getResources(); // Resource object to get Drawables
	    TabHost tabHost = getTabHost();  // The activity TabHost
	    TabHost.TabSpec spec;  // Resusable TabSpec for each tab
	    Intent intent;  // Reusable Intent for each tab
	    
	    Intent myLocalIntent = getIntent();
		// look into the bundle sent to Activity2 for data items
		Bundle myLocalBundle = myLocalIntent.getExtras();
		
	    // Create an Intent to launch an Activity for the tab (to be reused)
	    intent = new Intent().setClass(this, SearchBottle.class);
	    intent.putExtras(myLocalBundle);
	    
	    // Initialize a TabSpec for each tab and add it to the TabHost
	    spec = tabHost.newTabSpec("Rechercher").setIndicator("Rechercher",
	                      res.getDrawable(R.drawable.ic_tab_search))
	                  .setContent(intent);
	    tabHost.addTab(spec);

	    // Do the same for the other tabs
	    intent = new Intent().setClass(this, WineCellarList.class);
	    intent.putExtras(myLocalBundle);
	    spec = tabHost.newTabSpec("Listes des caves").setIndicator("Listes des caves",
	                      res.getDrawable(R.drawable.ic_tab_liste_cave))
	                  .setContent(intent);
	    tabHost.addTab(spec);

	    intent = new Intent().setClass(this, BottleCatalog.class);
	    intent.putExtras(myLocalBundle);
	    spec = tabHost.newTabSpec("Catalogues").setIndicator("Catalogues",
	                      res.getDrawable(R.drawable.ic_tab_catalogues))
	                  .setContent(intent);
	    tabHost.addTab(spec);

	    tabHost.setCurrentTab(0);
	}

}
